package day04.demo03;

/*
定义一个方法，用来求出1-100之间的所有数字的和值
 */
public class Demo02MethodSum {
    public static void main(String[] args) {
        System.out.println("结果是："+sum(1, 100));
    }

    public static int sum(int a, int b) {
        int s = 0;
        for (int i = a; i <= b; i++) {
            s += i;
        }
        return s;
    }
}
